<!DOCTYPE html>
<html>

<head>
    {include file="public/header"/}
    <script src="/static/tpl/js/pagetab.js"></script>
    <!-- <link rel="stylesheet" href="/static/cms/css/layui.css" media="all">
<link rel="stylesheet" href="/static/cms/css/admin.css" media="all"> -->
</head>

<body>
    {include file="public/channel"/}
    <div class="page-banner" style="">
        <img src="{$banner}" style="">
    </div>
    <div class="clear blank"></div>
    <article>
        <div class="page whitebg">
            <div class="page-title" id="pageContents">
                <ul>
                    {volist name="lchannel" id="v"}
                    <li><a href="/html/{$v.contro}/index/id/{$v.id}.html">{$v.name}</a></li>
                    {/volist}
                </ul>
            </div>
            <div class="page-box">
                <span class="hnav"> <a href="/">首页</a><a href="/html/{$modelxMark}/index/id/{$gcid}.html">{$gnavName}</a>{if condition="$pcid eq true"}<a href="/html/{$modelxMark}/index/id/{$pcid}.html">{$pnavName}</a>{/if}</span>
                <h2 class="page-box-title">联系我们</h2>
                <div class="page-box-content">
                    <section>
                        <div class="send-msg layui-form" lay-filter="">
                            <div class="layui-form-item">
                                <input type="text" name="title" value="" class="inputText" placeholder="标题" lay-verify="required">
                            </div>
                            <div class="layui-form-item">
                                <textarea name="content" class="inputText" placeholder="内容" lay-verify="required"></textarea>
                            </div>
                            <div class="layui-form-item">
                                <input type="text" name="username" value="" class="inputText" placeholder="姓名" lay-verify="required">
                            </div>
                            <div class="layui-form-item">
                                <input type="text" name="telphone" value="" class="inputText" placeholder="电话" lay-verify="required">
                            </div>
                            <div class="layui-form-item">
                                <input type="text" name="uemail" value="" class="inputText" placeholder="邮箱">
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-inline">
                                    <input type="text" name="vercode" value="" class="inputText" placeholder="验证码" lay-verify="required">
                                </div>
                                <div class="layui-form-mid">
                                    <img src="{:url('/html/base/showVerify')}" class="layadmin-user-login-codeimg" id="change-vercode">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <button class="inputsub-dl" lay-submit lay-filter="save_about">提交</button>
                            </div>
                            <div class="clear"></div>
                        </div>
                    </section>
                </div>
            </div>
        </div>
    </article>
    <div class="clear blank"></div>
    {include file="public/footer"/}
    <script src="/static/layadmin/layui/layui.js"></script>
    <script>
    layui.config({
        base: '/static/layadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'user', 'form'], function() {
        var $ = layui.$
            // ,setter = layui.setter
            // ,admin = layui.admin
            ,
            form = layui.form;
        // ,router = layui.router()
        // ,search = router.search;

        // form.render();

        //提交
        form.on('submit(save_about)', function(obj) {
            var field = obj.field; //获取提交的字段
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引  
            // layer.msg('表单已提交');
            // console.log(field);
            //提交 Ajax 成功后，关闭当前弹层并重载表格
            $.post('/index/message/domessage', { title: field.title, content: field.content, username: field.username, telphone: field.telphone, uemail: field.uemail, vercode: field.vercode }, function(res) {
                res = $.parseJSON(res);
                console.log(res);
                if (res.code == 200) {
                    layer.msg(res.msg, {
                        icon: 1,
                        time: 3000 //2秒关闭（如果不配置，默认是3秒）
                    }, function() {
                        window.location.reload();
                        // location.href = '/admin'; //后台主页
                    });
                } else {
                    layer.msg(res.msg, { icon: 2, time: 3000 });
                }
            });
        });

        //更换图形验证码
        $('body').on('click', '#change-vercode', function() {
            var othis = $(this);
            this.src += '?t=' + new Date().getTime();
        });

        //实际使用时记得删除该代码
        // layer.msg('为了方便演示，用户名密码可随意输入', {
        //   offset: '15px'
        //   ,icon: 1
        // });

    });
    </script>
</body>

</html>